<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <button>点击</button>
    <button>点击关闭</button>
    <button>点击跳转</button>
    <script>
      //   var btnEle = document.querySelector("button");
      //   btnEle.onclick = function () {
      //     window.open("http://www.baidu.com");
      //   };
      var btnEle2 = document.querySelectorAll("button")[1];
      btnEle2.onclick = function () {
        window.close();
      };
      var btnEle3 = document.querySelectorAll("button")[2];
      btnEle3.onclick = function () {
        window.location.href = "./a.html";
      };
    </script>
  </body>
</html>
